package com.rzt.entity;

import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.sql.Update;

import javax.persistence.*;
import javax.validation.constraints.NotNull;

@Data
@AllArgsConstructor
@Entity(name = "DATASOURCE")
public class DataSource {
    @Id
    @Column(name = "id")
    @NotNull(groups = Update.class)
    @ApiModelProperty(value = "ID", hidden = true)
    @GenericGenerator(name="idGenerator", strategy="uuid") //这个是hibernate的注解/生成32位UUID
    @GeneratedValue(generator="idGenerator")
    private String id;

    @ApiModelProperty(value = "用户名")
    @Column(name = "db_name")
    private String dbName;

    @ApiModelProperty(value = "密码")
    @Column(name = "db_password")
    private String dbPassword;

    @ApiModelProperty(value = "数据源url")
    @Column(name = "db_url")
    private String dbUrl;

    @ApiModelProperty(value = "数据源驱动")
    @Column(name = "db_drvider")
    private String dbDrivers;

    @ApiModelProperty(value = "数据源驱动")
    @Column(name = "db_type")
    private String dbType;


    public DataSource() {

    }
}
